function calTotal(initValue, times, ratio) {
  let total = 0;
  for (let i = 0; i < times; i++) {
    initValue = initValue + initValue * ratio;
    console.log('initValue: ', initValue * ratio / 12);
    total += initValue
  }
  console.log('total: ', total);
  return total;
}

// console.log('15年', calTotal(12000, 15, 0.03))
// console.log('15年', calTotal(12000, 15, 0.04))
// console.log('15年', calTotal(2000, 12 * 15, 0.03 / 12))

console.log(calTotal(calTotal(5000, 12 * 10, 0.03 / 12), 10, 0.03));